FROM registry.cn-hangzhou.aliyuncs.com/udh/jdk:1.8.141

RUN useradd -m redis

RUN rm -rf /etc/yum.repos.d/* && wget http://10.110.117.99/downloads/repo/centos.repo && mv centos.repo /etc/yum.repos.d && yum clean all
RUN yum install python-setuptools gcc-c++ make python-devel -y

RUN wget http://10.110.117.99/downloads/redis/pip-1.5.4.tar.gz && tar -zxvf pip-1.5.4.tar.gz -C /home/redis/ \
    && rm -f pip-1.5.4.tar.gz

RUN cd /home/redis/pip-1.5.4 && python setup.py install

RUN wget http://10.110.117.99/downloads/redis/zookeeper_c.tgz && tar -zxvf zookeeper_c.tgz -C /home/redis/ \
    && rm -f zookeeper_c.tgz
RUN cd /home/redis/c && ./configure && make && make install
RUN wget http://10.110.117.99/downloads/redis/zkpython-0.4.2.tar.gz && pip install zkpython-0.4.2.tar.gz && rm -f zkpython-0.4.2.tar.gz
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/libzookeeper.conf && ldconfig
RUN mkdir /home/redis/monitor && cd /home/redis/monitor && wget http://10.110.117.99/downloads/redis/redis_monitor_db.tgz  \
    && tar -zxvf redis_monitor_db.tgz -C /home/redis/monitor && rm -f /home/redis/monitor/redis_monitor_db.tgz
RUN cd /home/redis/monitor && wget http://10.110.117.99/downloads/redis/redis_monitor.tgz && tar -zxvf redis_monitor.tgz -C /home/redis/monitor \
    && rm -f /home/redis/monitor/redis_monitor.tgz
RUN cd /home/redis/monitor/redis_monitor && pip install argparse-1.2.1.tar.gz && pip install python-dateutil-1.5.tar.gz  \
    && pip install redis-2.10.6.tar.gz && pip install tornado-2.2.1.tar.gz
RUN chown redis:redis -R /home/redis
USER redis

WORKDIR /home/redis/


RUN wget http://10.110.117.99/downloads/redis/redis.tgz && tar -zxvf redis.tgz -C /home/redis/ \
    && rm -f redis.tgz && chmod 777 -R /home/redis/


ENV REDIS_HOME=/home/redis/redis
ENV REDIS_MONITOR=/home/redis/monitor/redis_monitor
ENV REDIS_MONITOR_DB=/home/redis/monitor/redis